/*
 *    POD: Plain Old Datatypes, just plug and play!
 *    Copyright (C) 2012  Jeremy W. Murphy <jeremy.william.murphy@gmail.com>
 *
 *    This program is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation, either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef PODS_H
#define PODS_H

/*  Plain old data type terminals!  */
#include "terminal.h"

#include <memory>


namespace rmitgprime
{
    template <typename ReturnType = double>
    class POD : public Terminal<ReturnType>
    {
        public:
            POD(ReturnType const &VALUE) : VALUE(VALUE) {};
            virtual ReturnType operator*() const { return VALUE; };

            ReturnType operator+(POD const &RHS) const { return VALUE + RHS.VALUE; };
            ReturnType operator-(POD const &RHS) const { return VALUE - RHS.VALUE; };
            ReturnType operator*(POD const &RHS) const { return VALUE * RHS.VALUE; };
            ReturnType operator/(POD const &RHS) const { return VALUE / RHS.VALUE; };
            ReturnType operator==(POD const &RHS) const { return VALUE == RHS.VALUE; };
            ReturnType operator!=(POD const &RHS) const { return VALUE != RHS.VALUE; };
            ReturnType operator<(POD const &RHS) const { return VALUE < RHS.VALUE; };
            ReturnType operator>(POD const &RHS) const { return VALUE > RHS.VALUE; };
            ReturnType operator<=(POD const &RHS) const { return VALUE <= RHS.VALUE; };
            ReturnType operator>=(POD const &RHS) const { return VALUE >= RHS.VALUE; };

        private:
            ReturnType const VALUE;
    };
}

#endif
